package com.yfp.client.controller;

import com.yfp.client.domain.dto.ActivitySignInsExchangeRecordReqDTO;
import com.yfp.client.domain.vo.ActivitySignInsExchangeRecordVO;
import com.yfp.client.domain.vo.ActivitySignInsRulesVO;
import com.yfp.client.domain.vo.ActivitySignInsVO;
import com.yfp.client.service.ActivitySignInsService;
import com.yfp.client.util.Response;
import com.yfp.common.core.web.controller.BaseController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/client/activity-sign-ins")
@Tag(name = "打卡活动")
public class ActivitySignInsController extends BaseController {

    @Resource
    private ActivitySignInsService activitySignInService;

    @GetMapping("activityDetails")
    @Operation(summary = "获取活动详细信息")
    public Response<ActivitySignInsVO> getActivityDetails(Long activitySignInsId, String cityName) {
        ActivitySignInsVO activityDetail = activitySignInService.getActivityDetails(activitySignInsId, cityName);
        return Response.success(activityDetail);
    }

    @GetMapping("join")
    @Operation(summary = "参加活动-立即参与")
    public Response<Void> joinActivity(Long activitySignInsId) {
        activitySignInService.joinActivity(activitySignInsId);
        return Response.success();
    }

    @GetMapping("receive")
    @Operation(summary = "领取奖励-立即领取")
    public Response<ActivitySignInsRulesVO> receiveReward(Long activitySignInsId) {
        ActivitySignInsRulesVO activitySignInsRulesVO = activitySignInService.receiveReward(activitySignInsId);
        return Response.success(activitySignInsRulesVO);
    }

    @GetMapping("record")
    @Operation(summary = "兑换记录")
    public Response<List<ActivitySignInsExchangeRecordVO>> exchangeRecord(ActivitySignInsExchangeRecordReqDTO exchangeRecordReqDTO) {
        List<ActivitySignInsExchangeRecordVO> activitySignInsExchangeRecordVOS = activitySignInService.exchangeRecord(exchangeRecordReqDTO);
        return Response.success(activitySignInsExchangeRecordVOS);
    }
}
